using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Util;
using Android.Graphics;

namespace CPXamarin
{
    public class ParallaxImageView :ImageView
    {
        private int mCurrentTranslation;

        public ParallaxImageView(Context context):base(context)
        {
        }

        public ParallaxImageView(Context context, IAttributeSet attrs):base(context, attrs)
        {

        }

        public ParallaxImageView(Context context, IAttributeSet attrs, int defStyle):base(context, attrs, defStyle) 
        {
        }

        public void SetCurrentTranslation(int currentTranslation)
        {
            mCurrentTranslation = currentTranslation;
            Invalidate ();
        }
 

        public void Draw(Canvas canvas) 
        {
            canvas.Save();
            canvas.Translate(0, -mCurrentTranslation / 2) ;
            base.Draw(canvas);
            canvas.Restore();
        }
    }
}